Main Page Modules Compound List File List Compound Members File Members Related Pages

# Memory allocation
[LibTDS API]

Allocate or free resources. More...

## Defines
#define | SQLS_ENTRY(number, state) case number: p = state; break
## Functions
TDSDYNAMIC * | tds_alloc_dynamic (TDSSOCKET *tds, const char *id)
| Allocate a dynamic statement.
void | tds_free_input_params (TDSDYNAMIC *dyn)
| Frees all allocated input parameters of a dynamic statement.
void | tds_free_dynamic (TDSSOCKET *tds, TDSDYNAMIC *dyn)
| Frees dynamic statement and remove from TDS.
void | tds_free_all_dynamic (TDSSOCKET *tds)
| Frees all dynamic statements for a given connection.
TDSPARAMINFO * | tds_alloc_param_result (TDSPARAMINFO *old_param)
| Adds a output parameter to TDSPARAMINFO.
unsigned char * | tds_alloc_param_row (TDSPARAMINFO *info, TDSCOLINFO *curparam)
| Add another field to row.
TDSCOMPUTEINFO ** | tds_alloc_compute_results (TDS_INT *num_comp_results, TDSCOMPUTEINFO **ci, int num_cols, int by_cols)
TDSRESULTINFO * | tds_alloc_results (int num_cols)
unsigned char * | tds_alloc_row (TDSRESULTINFO *res_info)
| Allocate space for row store return NULL on out of memory.
unsigned char * | tds_alloc_compute_row (TDSCOMPUTEINFO *res_info)
void | tds_free_param_results (TDSPARAMINFO *param_info)
void | tds_free_compute_result (TDSCOMPUTEINFO *comp_info)
void | tds_free_compute_results (TDSCOMPUTEINFO **comp_info, TDS_INT num_comp)
void | tds_free_results (TDSRESULTINFO *res_info)
void | tds_free_all_results (TDSSOCKET *tds)
TDSCONTEXT * | tds_alloc_context (void)
void | tds_free_context (TDSCONTEXT *context)
TDSLOCALE * | tds_alloc_locale (void)
TDSCONNECTINFO * | tds_alloc_connect (TDSLOCALE *locale)
| Allocate space for configure structure and initialize with default values.
TDS_CURSOR * | tds_alloc_cursor (char *name, TDS_INT namelen, char *query, TDS_INT querylen)
void | tds_free_cursor (TDS_CURSOR *cursor)
TDSLOGIN * | tds_alloc_login (void)
void | tds_free_login (TDSLOGIN *login)
TDSSOCKET * | tds_alloc_socket (TDSCONTEXT *context, int bufsize)
TDSSOCKET * | tds_realloc_socket (TDSSOCKET *tds, int bufsize)
void | tds_free_socket (TDSSOCKET *tds)
void | tds_free_locale (TDSLOCALE *locale)
void | tds_free_connect (TDSCONNECTINFO *connect_info)
void | tds_free_msg (TDSMSGINFO *msg_info)
char * | tds_alloc_client_sqlstate (int msgnum)
char * | tds_alloc_lookup_sqlstate (TDSSOCKET *tds, int msgnum)

## Detailed Description

Allocate or free resources.

Allocation can fail only on out of memory. In such case they return NULL and leave the state as before call.

## Function Documentation

TDSCONNECTINFO* tds_alloc_connect | ( | TDSLOCALE * | locale | ) |

  | Allocate space for configure structure and initialize with default values. Parameters:
  locale | locale information (copied to configuration information)
Returns: allocated structure or NULL if out of memory

TDSDYNAMIC * tds_alloc_dynamic | ( | TDSSOCKET * | tds,
|  | const char * | id
| ) |

  | Allocate a dynamic statement. Parameters:
  tds | the connection within which to allocate the statement.
  id | a character label identifying the statement.
Returns: a pointer to the allocated structure (NULL on failure). tds_alloc_dynamic is used to implement placeholder code under TDS 5.0

TDSPARAMINFO * tds_alloc_param_result | ( | TDSPARAMINFO * | old_param | ) |

  | Adds a output parameter to TDSPARAMINFO. Parameters:
  old_param | a pointer to the TDSPARAMINFO structure containing the current set of output parameter, or NULL if none exists.
Returns: a pointer to the new TDSPARAMINFO structure. tds_alloc_param_result() works a bit differently than the other alloc result functions. Output parameters come in individually with no total number given in advance, so we simply call this func every time with get a TDS_PARAM_TOKEN and let it realloc the columns struct one bigger. tds_free_all_results() usually cleans up after us.

unsigned char* tds_alloc_param_row | ( | TDSPARAMINFO * | info,
|  | TDSCOLINFO * | curparam
| ) |

  | Add another field to row. Is assumed that last TDSCOLINFO contain information about this. Update also info structure. Parameters:
  info | parameters info where is contained row
  curparam | parameter to retrieve size information
Returns: NULL on failure or new row

void tds_free_all_dynamic | ( | TDSSOCKET * | tds | ) |

  | Frees all dynamic statements for a given connection. Parameters:
  tds | the connection containing the dynamic statements to be freed.
tds_free_all_dynamic frees all dynamic statements for the given TDS socket and then zeros tds->dyns.

void tds_free_dynamic | ( | TDSSOCKET * | tds,
|  | TDSDYNAMIC * | dyn
| ) |

  | Frees dynamic statement and remove from TDS. Parameters:
  dyn | dynamic statement to be freed.

void tds_free_input_params | ( | TDSDYNAMIC * | dyn | ) |

  | Frees all allocated input parameters of a dynamic statement. Parameters:
  dyn | the dynamic statement whose input parameter are to be freed
tds_free_input_params frees all parameters for the give dynamic statement